﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TRPOP.Common;

namespace TRPOP.CMS.Model
{

    /// <summary>
    /// 广告参数信息模型
    /// </summary>
    [Serializable]
    public class AdvConfigInfo
    {

        #region  私有变量
        bool m_Enable = true;
        string m_URL_Dynamic = "/publish/Ads.aspx";
        string m_URL_Skip = "/publish/AdClick.aspx";
        string m_FilesRoot = "/ads/";
        bool m_DelPastFile = false;
        int m_Mode = 0;
        string m_ResourceRoot = "{PSN:1}/ads";
        string m_ResourceURL = "{PSN-URL:2}/ads";
        #endregion

        #region 成员函数

        /// <summary>
        /// 是否启用广告插件
        /// </summary>
        public bool Enable
        {
            get
            {
                return m_Enable;
            }
            set
            {
                m_Enable = value;
            }
        }


        /// <summary>
        /// 动态访问地址
        /// </summary>
        public string URL_Dynamic
        {
            get
            {
                return m_URL_Dynamic;
            }
            set
            {
                m_URL_Dynamic = value;
            }
        }

        /// <summary>
        /// 广告跳转地址
        /// </summary>
        public string URL_Skip
        {
            get
            {
                return m_URL_Skip;
            }
            set
            {
                m_URL_Skip = value;
            }
        }

        /// <summary>
        /// 静态生成目录
        /// </summary>
        public string FilesRoot
        {
            get
            {
                return m_FilesRoot;
            }
            set
            {
                m_FilesRoot = value;
            }
        }

        /// <summary>
        /// 删除过期的广告文件
        /// </summary>
        public bool DelPastFile
        {
            get
            {
                return m_DelPastFile;
            }
            set
            {
                m_DelPastFile = value;
            }
        }

        /// <summary>
        /// 广告的模式
        /// 0 静态
        /// 1 动态
        /// </summary>
        public int Mode
        {
            get
            {
                return m_Mode;
            }
            set
            {
                m_Mode = value;
            }
        }

        /// <summary>
        /// 广告资源发布点
        /// </summary>
        public string ResourceRoot
        {
            get
            {
                return m_ResourceRoot;
            }
            set
            {
                m_ResourceRoot = value;
            }
        }

        /// <summary>
        /// 广告资源发布URL
        /// </summary>
        public string ResourceURL
        {
            get
            {
                return m_ResourceURL;
            }
            set
            {
                m_ResourceURL = value;
            }
        }

        #endregion

    }
}
/*  类统一到了   SystemConfigHelper<ClassType> 里
    /// <summary>
    /// 评论参数信息模型
    /// </summary>
    public static class AdvConfigInfoHelper
    {
        static AdvConfigInfo mAdvConfigInfo;
        static string m_AdvConfigFileName = Common.Util.GetMapPath(SystemConst.ConfigRootName + SystemConst.SystemVar_AdvConfigFileName);

        /// <summary>
        /// 评论参数信息
        /// </summary>
        public static AdvConfigInfo RecommentConfig
        {
            get
            {
                if (mAdvConfigInfo != null)
                {
                    return mAdvConfigInfo;
                }
                else
                {

                    if (FileUtil.IsExist(m_AdvConfigFileName))
                    {
                        mAdvConfigInfo = SerializationHelper.Load(typeof(AdvConfigInfo), m_AdvConfigFileName) as AdvConfigInfo;
                    }

                    if (mAdvConfigInfo == null)
                    {
                        mAdvConfigInfo = new AdvConfigInfo();

                        SerializationHelper.Save(mAdvConfigInfo, m_AdvConfigFileName);
                    }

                    return mAdvConfigInfo;
                }
            }
        }

        /// <summary>
        /// 设置 评论参数信息
        /// </summary>
        /// <param name="oRecommentConfigInfo"></param>
        /// <returns></returns>
        public static bool SaveAdvConfig(AdvConfigInfo oAdvConfigInfo)
        {
            mAdvConfigInfo = oAdvConfigInfo;
            return SerializationHelper.Save(mAdvConfigInfo, m_AdvConfigFileName);
        }
    }

    */
